package com.ashen.study.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author hxl
 * @Classname AdviceAspect
 * @Description
 * @Date 2019/9/24 10:44
 */
@Aspect
@Component
public class AdviceAspect {




//    @Pointcut("execution(public * com.ashen.study.service.*Service.*(..)) && within(com.ashen.study..*)")
//    public  void  match(){
//
//    }
//    @Before("match() && args(userId)")
//    public void before(Integer userId){
//        System.out.println("before ....................................................." + userId);
//    }
//    @After("match()")
//    public void after(){
//        System.out.println("after.................................");
//    }
//    @AfterReturning(value = "match()",returning = "result")
//    public void afterReturning(boolean result){
//        System.out.println("afterReturning ................................" + result);
//    }
//    @AfterThrowing("match()")
//    public void afterThrowing(){
//        System.out.println("afterThrowing.................................................");
//    }
//    @Around("match()")
//    public Object around(ProceedingJoinPoint joinPoint){
//        System.out.println("before..............................");
//        Object result = null;
//        try {
//            result = joinPoint.proceed(joinPoint.getArgs());
//        } catch (Throwable throwable) {
//            System.out.println("exception ...................");
//            throwable.printStackTrace();
//        } finally {
//            System.out.println("finally .......................");
//        }
//        return result;
//    }
}
